﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ZYOPPC;

namespace ZYPPC6
{
    public partial class FormQM : Form
    {
        public FormQM()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            iniUI(DateTime.Now);
        }

        private void iniUI(DateTime dt)
        {
            QMCellCtrl[] QMCellCtrls = new QMCellCtrl[8] { qmCellCtrl1, qmCellCtrl2, qmCellCtrl3, qmCellCtrl4, qmCellCtrl5, qmCellCtrl6, qmCellCtrl7, qmCellCtrl8 };

            ZYOPPC.基本概念.Class奇门遁甲 qm = new ZYOPPC.基本概念.Class奇门遁甲(dt);
            ZYOPPC.ZYDateTime zydt = new ZYOPPC.ZYDateTime(dt);
            
            this.labelCenter.Text = zydt.Name;
            this.labelCenter.Text += "\r\n" + qm.局数.ToString()+"局";
            this.labelCenter.Text += "|值符" + qm.p值符.ToString();
            this.labelCenter.Text += "|值使" + qm.p值使.ToString();

            for (int i = 0; i < 8; i++)
            {
                QMCellCtrls[i].局数 = qm.局数;
                QMCellCtrls[i].值使 = qm.p值使;
                QMCellCtrls[i].值符 = qm.p值符;
                QMCellCtrls[i].当时八字 = zydt;
                QMCellCtrls[i].row宫 = qm.dt奇盘.Select(String.Format("位置='{0}'", i + 1));
            }
        }

        private void menuItemExit_Click(object sender, EventArgs e)
        {           
            this.Close();
        }

        private void menuItemOK_Click(object sender, EventArgs e)
        {
            iniUI(dateTimePicker1.Value);

        }

    }
}